package com.ywu.mq.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.mq.standard.dto.YwuKafkaTopicDto;
import com.ywu.mq.standard.service.YwuKafkaTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName YwuKafkaTopicApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/3/27 14:13
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/mq/kafka/topic")
public class YwuKafkaTopicApi {

    @Autowired
    private YwuKafkaTopicService service;

    /**
    * @Author GroundDemo
    * @Description 创建主题
    * @Date 14:32 2025/3/27
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/topic.create.info")
    public CommonResult<Object> createKafkaTopic(@RequestBody YwuKafkaTopicDto ywuKafkaTopicDto) {
        return service.createKafkaTopic(ywuKafkaTopicDto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改主题信息
    * @Date 16:09 2025/3/27
    * @Param [ywuKafkaTopicDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/topic.update.info")
    public CommonResult<Object> updateKafkaTopic(@RequestBody YwuKafkaTopicDto ywuKafkaTopicDto) {
        return service.updateKafkaTopic(ywuKafkaTopicDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询主题列表
    * @Date 15:45 2025/3/27
    * @Param [ywuKafkaTopicDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/topic.list.info")
    public CommonResult<Object> queryKafkaTopic(@RequestBody YwuKafkaTopicDto ywuKafkaTopicDto) {
        return service.queryKafkaTopic(ywuKafkaTopicDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询主题详情
    * @Date 8:31 2025/3/28
    * @Param [ywuKafkaTopicDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/topic.detail.info")
    public CommonResult<Object> queryKafkaTopicDetail(@RequestBody YwuKafkaTopicDto ywuKafkaTopicDto) {
        return service.queryKafkaTopicDetail(ywuKafkaTopicDto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除主题
    * @Date 15:30 2025/3/27
    * @Param [ywuKafkaTopicDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/topic.delete.info")
    public CommonResult<Object> deleteKafkaTopic(@RequestBody YwuKafkaTopicDto ywuKafkaTopicDto) {
        return service.deleteKafkaTopic(ywuKafkaTopicDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询kafka所有主题名称 - 直接调用kafka客户端查询
    * @Date 15:26 2025/3/27
    * @Param []
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/topic.source.info")
    public CommonResult<Object> getKafkaSourceTopic() {
        return service.getKafkaSourceTopic();
    }
}
